package com.couldsail.takeaway.controller.user;

import com.couldsail.takeaway.common.result.Result;
import com.couldsail.takeaway.pojo.dto.ShopDetailDTO;
import com.couldsail.takeaway.pojo.vo.ShopVO;
import com.couldsail.takeaway.service.ShopService;
import com.couldsail.takeaway.utils.AddressLocationUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController("UserShopController")
@RequestMapping("/user/shop")
@Api(tags = "店铺相关接口")
@RequiredArgsConstructor
@CrossOrigin(origins = "*")
public class ShopController {
    
    private final ShopService shopService;
    
    @ApiOperation("获取店铺列表")
    @GetMapping("/list")
    public Result<List<ShopVO>> list() {
        return Result.success(shopService.getShopList());
    }
    
    @ApiOperation("获取店铺详情")
    @GetMapping("/detail")
    public Result<ShopVO> getById(ShopDetailDTO shopDetailDTO) throws Exception {
        log.info("获取店铺详情{}",shopDetailDTO);
        return Result.success(shopService.getShopById(shopDetailDTO));
    }
} 